package com.novellotus.iov.carvice.adapter;

import android.content.Context;
import android.graphics.Color;
import android.support.v7.widget.RecyclerView;
import android.text.Spannable;
import android.text.SpannableStringBuilder;
import android.text.style.ForegroundColorSpan;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;

import com.novellotus.iov.carvice.R;
import com.novellotus.iov.carvice.bean.RxTaskDetail;
import com.novellotus.iov.carvice.utils.MyUtils;
import com.novellotus.iov.carvice.utils.MyViewUtils;
import com.novellotus.iov.carvice.utils.TimeUtils;

import java.util.List;

import butterknife.BindView;
import butterknife.ButterKnife;

/**
 * Created by Rich on 2017/7/31.
 */

public class TaskDetailAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {

    List<RxTaskDetail.ProgressBean> ordersBeanList;
    Context context;
    TaskDetailInterface taskDetailInterface;

    public TaskDetailAdapter(List<RxTaskDetail.ProgressBean> ordersBeanList, Context context, TaskDetailInterface taskDetailInterface) {
        this.context = context;
        this.ordersBeanList = ordersBeanList;
        this.taskDetailInterface = taskDetailInterface;
    }

    @Override
    public int getItemViewType(int position) {
        return ordersBeanList.get(position).getType();
    }

    @Override
    public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        View view;
        switch (viewType) {
            case 0:
                view = LayoutInflater.from(parent.getContext()).inflate(R.layout.layout_cancel, parent, false);
                return new CancelHolder(view);
            case 1:
                view = LayoutInflater.from(parent.getContext()).inflate(R.layout.layout_guarantee, parent, false);
                return new GuaranteeHolder(view);
            case 2:
                view = LayoutInflater.from(parent.getContext()).inflate(R.layout.layout_handle, parent, false);
                return new HandleHolder(view);
            case 3:
                view = LayoutInflater.from(parent.getContext()).inflate(R.layout.layout_cancel_station, parent, false);
                return new CancelStation(view);
            case 4:
                view = LayoutInflater.from(parent.getContext()).inflate(R.layout.layout_distribution, parent, false);
                return new DistributionHolder(view);
            case 5:
                view = LayoutInflater.from(parent.getContext()).inflate(R.layout.layout_forward, parent, false);
                return new ForwardHolder(view);
            case 6:
                view = LayoutInflater.from(parent.getContext()).inflate(R.layout.layout_repair, parent, false);
                return new RepairHolder(view);
            case 7:
                view = LayoutInflater.from(parent.getContext()).inflate(R.layout.layout_confirm, parent, false);
                return new ConfirmHolder(view);
        }
        return null;
    }

    @Override
    public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) {
        if (ordersBeanList.get(position) != null) {
            switch (ordersBeanList.get(position).getType()) {
                case 0:
                    setCancel((CancelHolder) holder, position);
                    break;
                case 1:
                    setGuarantee((GuaranteeHolder) holder, position);
                    break;
                case 2:
                    setHandle((HandleHolder) holder, position);
                    break;
                case 3:
                    setCancelStation((CancelStation) holder, position);
                    break;
                case 4:
                    setDistribution((DistributionHolder) holder, position);
                    break;
                case 5:
                    setForward((ForwardHolder) holder, position);
                    break;
                case 6:
                    setRepair((RepairHolder) holder, position);
                    break;
                case 7:
                    setConfirm((ConfirmHolder) holder, position);
                    break;
            }
        }


    }


    /**
     * 设置取消站点布局
     *
     * @param holder
     * @param position
     */
    private void setCancelStation(CancelStation holder, int position) {
        if (position == 0) {
            holder.view_top.setVisibility(View.VISIBLE);
            holder.img_first_point.setVisibility(View.VISIBLE);
            holder.img_point.setVisibility(View.INVISIBLE);
        } else if (position == ordersBeanList.size() - 1) {
            holder.view_top.setVisibility(View.GONE);
            holder.view_line.setVisibility(View.GONE);
            holder.img_first_point.setVisibility(View.GONE);
            holder.img_point.setVisibility(View.VISIBLE);
        } else {
            holder.view_top.setVisibility(View.GONE);
            holder.view_line.setVisibility(View.VISIBLE);
            holder.img_first_point.setVisibility(View.GONE);
            holder.img_point.setVisibility(View.VISIBLE);
        }
        if (ordersBeanList.get(position) != null) {
            holder.tv_name.setText("站点取消—" + getString(ordersBeanList.get(position).getCreator()));
            holder.tv_time.setText(TimeUtils.stampTotime(ordersBeanList.get(position).getCreateTime() + ""));
            if (ordersBeanList.get(position).getInfo() != null) {
                holder.tv_reason.setText(getTextColor("取消原因: ", ordersBeanList.get(position).getInfo().getRemark()));
            }
        }


    }


    /**
     * 设置报修布局
     *
     * @param holder
     * @param position
     */
    private void setGuarantee(GuaranteeHolder holder, final int position) {
        if (position == 0) {
            holder.view_top.setVisibility(View.VISIBLE);
            holder.img_first_point.setVisibility(View.VISIBLE);
            holder.img_point.setVisibility(View.INVISIBLE);
        } else if (position == ordersBeanList.size() - 1) {
            holder.view_top.setVisibility(View.GONE);
            holder.view_line.setVisibility(View.GONE);
            holder.img_first_point.setVisibility(View.GONE);
            holder.img_point.setVisibility(View.VISIBLE);
        } else {
            holder.view_top.setVisibility(View.GONE);
            holder.view_line.setVisibility(View.VISIBLE);
            holder.img_first_point.setVisibility(View.GONE);
            holder.img_point.setVisibility(View.VISIBLE);
        }
        if (ordersBeanList.size() == 1) {
            holder.view_top.setVisibility(View.GONE);
            holder.view_line.setVisibility(View.GONE);
            holder.img_first_point.setVisibility(View.VISIBLE);
            holder.img_point.setVisibility(View.INVISIBLE);
        }
        if (ordersBeanList.get(position) != null) {
            holder.tv_name.setText("报修—" + getString(ordersBeanList.get(position).getCreator()));
            holder.tv_time.setText(TimeUtils.stampTotime(ordersBeanList.get(position).getCreateTime() + ""));
            if (ordersBeanList.get(position).getInfo() != null) {
                holder.tv_contacts.setText(getTextColor("联  系  人: ", ordersBeanList.get(position).getInfo().getLinkman()));
                holder.tv_phone.setText(getTextColor("联系电话: ", ordersBeanList.get(position).getInfo().getMobile()));
                holder.tv_company.setText(getTextColor("所属企业: ", ordersBeanList.get(position).getInfo().getEname()));
                holder.tv_type.setText(getTextColor("故障类型: ", ordersBeanList.get(position).getInfo().getFault()));
                holder.tv_marker.setText(getTextColor("备        注: ", ordersBeanList.get(position).getInfo().getRemark()));
                holder.tv_location.setText(getString(ordersBeanList.get(position).getInfo().getAddress()));
                holder.tv_phone.setOnClickListener(new View.OnClickListener() {
                    @Override
                    public void onClick(View view) {
                        taskDetailInterface.call(ordersBeanList.get(position).getInfo().getMobile());
                    }
                });
            }
        }
    }

    /**
     * 设置处理布局
     *
     * @param holder
     * @param position
     */
    private void setHandle(HandleHolder holder, final int position) {
        if (position == 0) {
            holder.view_top.setVisibility(View.VISIBLE);
            holder.img_first_point.setVisibility(View.VISIBLE);
            holder.img_point.setVisibility(View.INVISIBLE);
        } else if (position == ordersBeanList.size() - 1) {
            holder.view_top.setVisibility(View.GONE);
            holder.view_line.setVisibility(View.GONE);
            holder.img_first_point.setVisibility(View.GONE);
            holder.img_point.setVisibility(View.VISIBLE);
        } else {

            holder.view_top.setVisibility(View.GONE);
            holder.view_line.setVisibility(View.VISIBLE);
            holder.img_first_point.setVisibility(View.GONE);
            holder.img_point.setVisibility(View.VISIBLE);
        }

        if (ordersBeanList.get(position) != null) {
            holder.tv_name.setText("处理报修单—" + getString(ordersBeanList.get(position).getCreator()));
            holder.tv_time.setText(TimeUtils.stampTotime(ordersBeanList.get(position).getCreateTime() + ""));
            if (ordersBeanList.get(position).getInfo() != null) {
                holder.tv_contacts.setText(getTextColor("客服人员: ", ordersBeanList.get(position).getInfo().getUname()));
                holder.tv_phone.setText(getTextColor("联系电话: ", ordersBeanList.get(position).getInfo().getMobile()));
                holder.tv_company.setText(getTextColor("维修企业: ", ordersBeanList.get(position).getInfo().getEname()));
                holder.tv_address.setText(getTextColor("维修站点: ", ordersBeanList.get(position).getInfo().getSname()));
                holder.tv_station.setText(getTextColor("站点电话: ", ordersBeanList.get(position).getInfo().getSphone()));
                holder.tv_phone.setOnClickListener(new View.OnClickListener() {
                    @Override
                    public void onClick(View view) {
                        taskDetailInterface.call(ordersBeanList.get(position).getInfo().getMobile());
                    }
                });
                holder.tv_station.setOnClickListener(new View.OnClickListener() {
                    @Override
                    public void onClick(View view) {
                        taskDetailInterface.call(ordersBeanList.get(position).getInfo().getSphone());
                    }
                });
            }
        }

    }

    /**
     * 设置分配布局
     *
     * @param holder
     * @param position
     */
    private void setDistribution(DistributionHolder holder, final int position) {

        if (position == 0) {
            holder.view_top.setVisibility(View.VISIBLE);
            holder.img_first_point.setVisibility(View.VISIBLE);
            holder.img_point.setVisibility(View.INVISIBLE);
        } else if (position == ordersBeanList.size() - 1) {
            holder.view_top.setVisibility(View.GONE);
            holder.view_line.setVisibility(View.GONE);
            holder.img_first_point.setVisibility(View.GONE);
            holder.img_point.setVisibility(View.VISIBLE);
        } else {

            holder.view_top.setVisibility(View.GONE);
            holder.view_line.setVisibility(View.VISIBLE);
            holder.img_first_point.setVisibility(View.GONE);
            holder.img_point.setVisibility(View.VISIBLE);
        }
        if (ordersBeanList.get(position) != null) {
            holder.tv_name.setText("分配报修单—" + getString(ordersBeanList.get(position).getCreator()));
            holder.tv_time.setText(TimeUtils.stampTotime(ordersBeanList.get(position).getCreateTime() + ""));
            if (ordersBeanList.get(position).getInfo() != null) {
                holder.tv_contacts.setText(getTextColor("维  修  人: ", ordersBeanList.get(position).getInfo().getUname()));
                holder.tv_phone.setText(getTextColor("联系电话: ", ordersBeanList.get(position).getInfo().getPhone()));
                holder.tv_phone.setOnClickListener(new View.OnClickListener() {
                    @Override
                    public void onClick(View view) {
                        taskDetailInterface.call(ordersBeanList.get(position).getInfo().getPhone());
                    }
                });
            }

        }
    }

    /**
     * 设置维修布局
     *
     * @param holder
     * @param position
     */
    private void setRepair(RepairHolder holder, int position) {
        if (position == 0) {
            holder.view_top.setVisibility(View.VISIBLE);
            holder.img_first_point.setVisibility(View.VISIBLE);
            holder.img_point.setVisibility(View.INVISIBLE);
        } else if (position == ordersBeanList.size() - 1) {
            holder.view_top.setVisibility(View.GONE);
            holder.view_line.setVisibility(View.GONE);
            holder.img_first_point.setVisibility(View.GONE);
            holder.img_point.setVisibility(View.VISIBLE);
        } else {

            holder.view_top.setVisibility(View.GONE);
            holder.view_line.setVisibility(View.VISIBLE);
            holder.img_first_point.setVisibility(View.GONE);
            holder.img_point.setVisibility(View.VISIBLE);
        }
        if (ordersBeanList.get(position) != null) {
            holder.tv_name.setText("维修—" + getString(ordersBeanList.get(position).getCreator()));
            holder.tv_time.setText(TimeUtils.stampTotime(ordersBeanList.get(position).getCreateTime() + ""));
            if (ordersBeanList.get(position).getInfo() != null) {
                holder.tv_type.setText(getTextColor("故障类型: ", ordersBeanList.get(position).getInfo().getFaults()));
                holder.tv_reason.setText(getTextColor("故障原因: ", ordersBeanList.get(position).getInfo().getAlarm()));
                holder.tv_result.setText(getTextColor("处理结果: ", ordersBeanList.get(position).getInfo().getCause()));
            }
        }
    }

    /**
     * 设置转发布局
     *
     * @param holder
     * @param position
     */
    private void setForward(ForwardHolder holder, final int position) {
        if (position == 0) {
            holder.view_top.setVisibility(View.VISIBLE);
            holder.img_first_point.setVisibility(View.VISIBLE);
            holder.img_point.setVisibility(View.INVISIBLE);
        } else if (position == ordersBeanList.size() - 1) {
            holder.view_top.setVisibility(View.GONE);
            holder.view_line.setVisibility(View.GONE);
            holder.img_first_point.setVisibility(View.GONE);
            holder.img_point.setVisibility(View.VISIBLE);
        } else {

            holder.view_top.setVisibility(View.GONE);
            holder.view_line.setVisibility(View.VISIBLE);
            holder.img_first_point.setVisibility(View.GONE);
            holder.img_point.setVisibility(View.VISIBLE);
        }
        if (ordersBeanList.get(position) != null) {
            holder.tv_name.setText("转发—" + getString(ordersBeanList.get(position).getCreator()));
            holder.tv_time.setText(TimeUtils.stampTotime(ordersBeanList.get(position).getCreateTime() + ""));
            if (ordersBeanList.get(position).getInfo() != null) {
                holder.tv_contacts.setText(getTextColor("联  系  人: ", ordersBeanList.get(position).getInfo().getUname()));
                holder.tv_phone.setText(getTextColor("联系电话: ", ordersBeanList.get(position).getInfo().getPhone()));
                holder.tv_reason.setText(getTextColor("转发说明: ", ordersBeanList.get(position).getInfo().getRemark()));
                holder.tv_address.setText(getTextColor("转发站点: ", ordersBeanList.get(position).getInfo().getSname()));
                holder.tv_location.setText(getString(ordersBeanList.get(position).getInfo().getAddress()));
                holder.tv_phone.setOnClickListener(new View.OnClickListener() {
                    @Override
                    public void onClick(View view) {
                        taskDetailInterface.call(ordersBeanList.get(position).getInfo().getPhone());
                    }
                });
            }
        }
    }

    /**
     * 设置取消布局
     *
     * @param holder
     * @param position
     */
    private void setCancel(CancelHolder holder, final int position) {
        if (position == 0) {
            holder.view_top.setVisibility(View.VISIBLE);
            holder.img_first_point.setVisibility(View.VISIBLE);
            holder.img_point.setVisibility(View.INVISIBLE);
        } else if (position == ordersBeanList.size() - 1) {
            holder.view_top.setVisibility(View.GONE);
            holder.view_line.setVisibility(View.GONE);
            holder.img_first_point.setVisibility(View.GONE);
            holder.img_point.setVisibility(View.VISIBLE);
        } else {

            holder.view_top.setVisibility(View.GONE);
            holder.view_line.setVisibility(View.VISIBLE);
            holder.img_first_point.setVisibility(View.GONE);
            holder.img_point.setVisibility(View.VISIBLE);
        }
        if (ordersBeanList.get(position) != null) {
            holder.tv_name.setText("取消处理—" + getString(ordersBeanList.get(position).getCreator()));
            holder.tv_time.setText(TimeUtils.stampTotime(ordersBeanList.get(position).getCreateTime() + ""));
            if (ordersBeanList.get(position).getInfo() != null) {
                holder.tv_contacts.setText(getTextColor("客服人员: ", ordersBeanList.get(position).getInfo().getUname()));
                holder.tv_phone.setText(getTextColor("联系电话: ", ordersBeanList.get(position).getInfo().getPhone()));
                holder.tv_reason.setText(getTextColor("联系电话: ", ordersBeanList.get(position).getInfo().getRemark()));
                holder.tv_phone.setOnClickListener(new View.OnClickListener() {
                    @Override
                    public void onClick(View view) {
                        taskDetailInterface.call(ordersBeanList.get(position).getInfo().getPhone());
                    }
                });
            }
        }
    }

    /**
     * 设置确认布局
     *
     * @param holder
     * @param position
     */
    private void setConfirm(ConfirmHolder holder, int position) {
        if (position == 0) {
            holder.view_top.setVisibility(View.VISIBLE);
            holder.img_first_point.setVisibility(View.VISIBLE);
            holder.img_point.setVisibility(View.INVISIBLE);
        } else if (position == ordersBeanList.size() - 1) {
            holder.view_top.setVisibility(View.GONE);
            holder.view_line.setVisibility(View.GONE);
            holder.img_first_point.setVisibility(View.GONE);
            holder.img_point.setVisibility(View.VISIBLE);
        } else {

            holder.view_top.setVisibility(View.GONE);
            holder.view_line.setVisibility(View.VISIBLE);
            holder.img_first_point.setVisibility(View.GONE);
            holder.img_point.setVisibility(View.VISIBLE);
        }
        if (ordersBeanList.get(position) != null) {
            holder.tv_name.setText("客户确认—" + getString(ordersBeanList.get(position).getCreator()));
            holder.tv_time.setText(TimeUtils.stampTotime(ordersBeanList.get(position).getCreateTime() + ""));
            if (ordersBeanList.get(position).getInfo() != null) {
                MyViewUtils.initImage(ordersBeanList.get(position).getInfo().getSignimg(), holder.img_sign, context);
                holder.tv_location.setText(getString(ordersBeanList.get(position).getInfo().getAddress()));
            }
        }
    }


    /**
     * 改变字符串颜色
     *
     * @param tittle
     * @param des
     * @return
     */
    private SpannableStringBuilder getTextColor(String tittle, String des) {
        if (des == null || des.length() == 0 || des.equals("null")) {
            des = " - -";
        }
        String text = tittle + des;
        SpannableStringBuilder style = new SpannableStringBuilder(text);
        style.setSpan(new ForegroundColorSpan(Color.parseColor("#666666")), 0, tittle.length(), Spannable.SPAN_EXCLUSIVE_INCLUSIVE);     //设置指定位置textview的背景颜色

        style.setSpan(new ForegroundColorSpan(Color.parseColor("#333333")), tittle.length(), text.length(), Spannable.SPAN_EXCLUSIVE_INCLUSIVE);     //设置指定位置文字的颜色
        return style;
    }

    private String getString(String str) {
        String s = str;
        if (str == null || str.equals("null")) {
            s = " - -";
        }
        return s;
    }

    @Override
    public int getItemCount() {
        return ordersBeanList.size();
    }

    class CancelStation extends RecyclerView.ViewHolder {

        @BindView(R.id.tv_name)
        TextView tv_name;
        @BindView(R.id.tv_time)
        TextView tv_time;
        @BindView(R.id.tv_reason)
        TextView tv_reason;
        @BindView(R.id.img_first_point)
        ImageView img_first_point;
        @BindView(R.id.img_point)
        ImageView img_point;
        @BindView(R.id.view_top)
        View view_top;
        @BindView(R.id.view_bottom)
        View view_bottom;
        @BindView(R.id.view_line)
        View view_line;

        CancelStation(View itemView) {
            super(itemView);
            ButterKnife.bind(this, itemView);
        }
    }

    /**
     * 报修
     */
    class GuaranteeHolder extends RecyclerView.ViewHolder {

        @BindView(R.id.tv_name)
        TextView tv_name;
        @BindView(R.id.tv_time)
        TextView tv_time;
        @BindView(R.id.tv_contacts)
        TextView tv_contacts;
        @BindView(R.id.tv_phone)
        TextView tv_phone;
        @BindView(R.id.tv_company)
        TextView tv_company;
        @BindView(R.id.tv_marker)
        TextView tv_marker;
        @BindView(R.id.tv_type)
        TextView tv_type;
        @BindView(R.id.tv_location)
        TextView tv_location;
        @BindView(R.id.img_first_point)
        ImageView img_first_point;
        @BindView(R.id.img_point)
        ImageView img_point;
        @BindView(R.id.view_top)
        View view_top;
        @BindView(R.id.view_bottom)
        View view_bottom;
        @BindView(R.id.view_line)
        View view_line;

        GuaranteeHolder(View itemView) {
            super(itemView);
            ButterKnife.bind(this, itemView);
        }
    }

    /**
     * 处理报修单
     */
    class HandleHolder extends RecyclerView.ViewHolder {

        @BindView(R.id.img_first_point)
        ImageView img_first_point;
        @BindView(R.id.img_point)
        ImageView img_point;
        @BindView(R.id.view_top)
        View view_top;
        @BindView(R.id.view_bottom)
        View view_bottom;
        @BindView(R.id.view_line)
        View view_line;
        @BindView(R.id.tv_name)
        TextView tv_name;
        @BindView(R.id.tv_time)
        TextView tv_time;
        @BindView(R.id.tv_contacts)
        TextView tv_contacts;
        @BindView(R.id.tv_phone)
        TextView tv_phone;
        @BindView(R.id.tv_company)
        TextView tv_company;
        @BindView(R.id.tv_station)
        TextView tv_station;
        @BindView(R.id.tv_address)
        TextView tv_address;

        HandleHolder(View itemView) {
            super(itemView);
            ButterKnife.bind(this, itemView);
        }
    }

    /**
     * 分配报修单
     */
    class DistributionHolder extends RecyclerView.ViewHolder {

        @BindView(R.id.img_first_point)
        ImageView img_first_point;
        @BindView(R.id.img_point)
        ImageView img_point;
        @BindView(R.id.view_top)
        View view_top;
        @BindView(R.id.view_bottom)
        View view_bottom;
        @BindView(R.id.view_line)
        View view_line;
        @BindView(R.id.tv_name)
        TextView tv_name;
        @BindView(R.id.tv_time)
        TextView tv_time;
        @BindView(R.id.tv_contacts)
        TextView tv_contacts;
        @BindView(R.id.tv_phone)
        TextView tv_phone;

        DistributionHolder(View itemView) {
            super(itemView);
            ButterKnife.bind(this, itemView);
        }
    }

    /**
     * 维修
     */
    class RepairHolder extends RecyclerView.ViewHolder {

        @BindView(R.id.img_first_point)
        ImageView img_first_point;
        @BindView(R.id.img_point)
        ImageView img_point;
        @BindView(R.id.view_top)
        View view_top;
        @BindView(R.id.view_bottom)
        View view_bottom;
        @BindView(R.id.view_line)
        View view_line;
        @BindView(R.id.tv_name)
        TextView tv_name;
        @BindView(R.id.tv_time)
        TextView tv_time;
        @BindView(R.id.tv_reason)
        TextView tv_reason;
        @BindView(R.id.tv_type)
        TextView tv_type;
        @BindView(R.id.tv_result)
        TextView tv_result;

        RepairHolder(View itemView) {
            super(itemView);
            ButterKnife.bind(this, itemView);
        }
    }

    /**
     * 转发
     */
    class ForwardHolder extends RecyclerView.ViewHolder {

        @BindView(R.id.img_first_point)
        ImageView img_first_point;
        @BindView(R.id.img_point)
        ImageView img_point;
        @BindView(R.id.view_top)
        View view_top;
        @BindView(R.id.view_bottom)
        View view_bottom;
        @BindView(R.id.view_line)
        View view_line;
        @BindView(R.id.tv_name)
        TextView tv_name;
        @BindView(R.id.tv_time)
        TextView tv_time;
        @BindView(R.id.tv_contacts)
        TextView tv_contacts;
        @BindView(R.id.tv_phone)
        TextView tv_phone;
        @BindView(R.id.tv_reason)
        TextView tv_reason;
        @BindView(R.id.tv_location)
        TextView tv_location;
        @BindView(R.id.tv_address)
        TextView tv_address;

        ForwardHolder(View itemView) {
            super(itemView);
            ButterKnife.bind(this, itemView);
        }
    }

    /**
     * 取消
     */
    class CancelHolder extends RecyclerView.ViewHolder {

        @BindView(R.id.img_first_point)
        ImageView img_first_point;
        @BindView(R.id.img_point)
        ImageView img_point;
        @BindView(R.id.view_top)
        View view_top;
        @BindView(R.id.view_bottom)
        View view_bottom;
        @BindView(R.id.view_line)
        View view_line;
        @BindView(R.id.tv_name)
        TextView tv_name;
        @BindView(R.id.tv_time)
        TextView tv_time;
        @BindView(R.id.tv_contacts)
        TextView tv_contacts;
        @BindView(R.id.tv_phone)
        TextView tv_phone;
        @BindView(R.id.tv_reason)
        TextView tv_reason;

        CancelHolder(View itemView) {
            super(itemView);
            ButterKnife.bind(this, itemView);
        }
    }

    /**
     * 客户确认
     */
    class ConfirmHolder extends RecyclerView.ViewHolder {

        @BindView(R.id.img_first_point)
        ImageView img_first_point;
        @BindView(R.id.img_point)
        ImageView img_point;
        @BindView(R.id.view_top)
        View view_top;
        @BindView(R.id.view_bottom)
        View view_bottom;
        @BindView(R.id.view_line)
        View view_line;
        @BindView(R.id.tv_name)
        TextView tv_name;
        @BindView(R.id.tv_time)
        TextView tv_time;
        @BindView(R.id.img_sign)
        ImageView img_sign;
        @BindView(R.id.tv_location)
        TextView tv_location;

        ConfirmHolder(View itemView) {
            super(itemView);
            ButterKnife.bind(this, itemView);
        }
    }

    public interface TaskDetailInterface {
        void call(String phone);
    }
}
